package _interview75;

/**
 * 1318. 或运算的最小翻转次数
 */
public class No1318 {
    public int minFlips(int a, int b, int c) {
        int ans = 0;
        for (int i = 0; i < 32; i++) {
            int bitC = c >> i & 1;
            int bitA = a >> i & 1;
            int bitB = b >> i & 1;
            if ((bitA | bitB) != bitC) ans += (bitA + bitB) == 2 ? 2 : 1;
        }
        return ans;
    }
}
